import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../layout/Home.vue";
import Dash from "../views/Dashboard/";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: "/home",
    component: Home,
    redirect: "/dashboard",
    children: [
      {
        path: "/dashboard",
        component: Dash
      },
      {
        path: "/order",
        component: () =>
          import(/* webpackChunkName: "login" */ "../views/Order/index.vue")
      },
      {
        path: "/goods",
        component: () =>
          import(/* webpackChunkName: "login" */ "../views/Goods/index.vue"),
        children: [
          {
            path: "/goods/list",
            component: () =>
              import(/* webpackChunkName: "list" */ "../views/Goods/list.vue")
          },
          {
            path: "/goods/add",
            component: () =>
              import(/* webpackChunkName: "add" */ "../views/Goods/add.vue")
          },
          {
            path: "/goods/cate",
            component: () =>
              import(/* webpackChunkName: "cata" */ "../views/Goods/cate.vue")
          }
        ]
      }
    ]
  },
  {
    path: "/login",
    component: () =>
      import(/* webpackChunkName: "login" */ "../views/Login.vue")
  }
];
//  component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')

const router = new VueRouter({
  routes
});

export default router;
